import Vue from 'vue'
import App from './App.vue'
import router from './routers/router'
import store from './stores/store'


// mock
// require("./mock/mock");

// 引入 axios
import axios from "axios"

Vue.prototype.axios = axios;
axios.defaults.baseURL="http://192.168.20.45:8082/comprehens"

// 引入elementUI
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);

// 引入 api
import api from "@/api/api"
Vue.prototype.api = api;

// 全局过滤器
// 导入全局过滤器
import filters from "./filters/filters"

Object.keys(filters).forEach(key => Vue.filter(key, filters[key]))

// 图片懒加载
import lazyLoad from "vue-lazyload"
Vue.use(lazyLoad,{
    loading:"./assets/images/lazy_loader.gif"
})

// 引入外部css
import "./assets/css/base.css"


// router.afterEach((to, from) => {
//     //会在任意路由跳转后执行
//     console.log(window.location.href.split("/").pop())
// })

// 全局过滤器
// 导入全局过滤器
import filter from "./filters/filters"

Object.keys(filter).forEach(key => Vue.filter(key, filter[key]))

// 页面跳转回到顶部
// 页面跳转回到顶部
router.afterEach((to,from,next)=>{
    window.scrollTo(0,0)
});

Vue.config.productionTip = false;

new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')
